<!DOCTYPE html>
<html>
    <head>
        <title>Test that the callback is not garbage collected if registered.</title>
        <script src="../../resources/testharness.js"></script>
        <script src="../../resources/testharnessreport.js"></script>
        <script src="../../resources/gc.js"></script>
            </head>
    <body>
        <script>
            async_test(function(t)
            {
                var v = document.createElement('video');
                v.src = '../content/test.ogv';
                document.body.appendChild(v);

                function callback(available) {}
                var callbackRef = t.step_func_done(callback);

                v.remote.watchAvailability(callbackRef).then(
                        function() { callbackRef = null; gc(); },
                        t.unreached_func());
            }, 'Test that the callback is not garbage collected if registered.');
        </script>
    </body>
</html>
